package com.gxar.quick.ar.server.base.common.enums.protocol;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * AR透明度
 *
 * @author zxh
 * @version 1.0
 * @created 2024/02/23.
 */
@Getter
public enum ArAlphaMode {

    OPAQUE("OPAQUE", "完全不透明"),
    MASK("MASK", "根据 alpha 值和指定的 alphaCutoff 值来决定是完全不透明还是完全透明"),
    BLEND("BLEND", "混合"),

    ;

    private final String name;
    private final String desc;

    ArAlphaMode(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    @JsonCreator
    public static ArAlphaMode getByName(String name) {
        Optional<ArAlphaMode> targetEnum = Arrays.stream(ArAlphaMode.values()).filter(e -> e.getName().equals(name)).findFirst();
        return targetEnum.orElse(null);
    }

}
